package logic

import (
	"context"
	"medical/models/mysql"

	"medical/medicalrpc/internal/svc"
	"medical/medicalrpc/medicalrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShopShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopShowLogic {
	return &ShopShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShopShowLogic) ShopShow(in *medicalrpc.ShopShowRequest) (*medicalrpc.ShopShowResponse, error) {
	// todo: add your logic here and delete this line

	var shop mysql.Shop

	mysql.DB.Debug().Where("id=?", in.Id).Find(&shop)
	return &medicalrpc.ShopShowResponse{
		Id:     int64(shop.ID),
		Num:    int64(shop.Num),
		Name:   shop.Name,
		Type:   shop.Type,
		Status: shop.Status,
	}, nil
}
